require("../../../utils/function.js");

var e = getApp(), s = require("../../../api.js");

Page({
    data: {
        sign: ""
    },
    getSign: function(e) {
        console.log(e);
        var s = e.detail.value;
        this.setData({
            sign: s
        });
    },
    getComplain: function() {
        var a = this;
        wx.showLoading({}), e.request({
            url: s.user.signature,
            method: "post",
            data: {
                signature: a.data.sign
            },
            success: function(e) {
                wx.hideLoading(), console.log(e), 1 == e.code ? wx.showToast({
                    title: e.msg,
                    icon: "none",
                    success: function() {
                        wx.navigateBack({
                            delta: 1
                        });
                    }
                }) : wx.showToast({
                    title: "请不好重复以前的签名",
                    icon: "none",
                    success: function() {
                        wx.navigateBack({
                            delta: 1
                        });
                    }
                });
            }
        });
    },
    onShow: function() {
        var a = wx.getStorageSync("user_info").signature, t = this;
        console.log(a), a && e.request({
            url: s.user.getsignature,
            method: "post",
            data: {},
            success: function(e) {
                t.setData({
                    sign: e.data.signature
                });
            }
        });
    },
    onLoad: function(s) {
        s.uid && e.shareCouponsMessage(s.uid);
    },
    onShareAppMessage: function() {
        var s = e.shareAppMessage().title, a = e.shareAppMessage().imageUrl, t = e.shareAppMessage().desc, n = e.shareAppMessage().path;
        return console.log(e.shareAppMessage()), {
            title: s,
            imageUrl: a,
            desc: t,
            path: n
        };
    }
});